local skynet = require "skynet"
require "skynet.manager"

local base = require "util.base"
local class = require "util.class"
local storemgr = class(base)

--storemgr的构造函数
function storemgr:ctor()
	self.queue = {} --仓库队列
	self.uplimit = 10 --仓库上限
	self.virtualadd = 0 --虚拟增加的数量
	self.producerlist = {}
	self.consumerlist = {}

	self.goods = {playerId = 11102, name = "mhl"}
end

function storemgr:produce() --goods：接收到生产出的商品
	-- goods.playerId = 220005
	-- goods.name = "mhk"
	skynet.error("store show playerId :", self.goods.playerId)
	skynet.error("store show name :", self.goods.name)
end

function storemgr:getGoods()
	return self.goods
end

function storemgr:get_goods()
	skynet.retpack(self:getGoods())
end

skynet.start(function()
    --给仓库服务起个别名
	skynet.register(".store")
	local mgr = storemgr.new()	
	
    --注册"lua"类型消息的处理函数，sign为消息的标志
    skynet.dispatch("lua", function(session, address, sign, ...)
		mgr:run(sign, ...)
	end)
end)